package org.carabiner.infopanel;

import java.awt.Color;
import java.awt.Component;

import javax.swing.Icon;

import junit.framework.TestCase;

/**
 * <p>
 * Carabiner Testing Framework
 * </p>
 * <p>
 * Copyright: <a href="http://www.gnu.org/licenses/gpl.html">GNU Public License</a>
 * </p>
 * 
 * @author John Januskey (john.januskey@gmail.com)
 * 
 */
public abstract class AbstractTestCarabinerMessage extends TestCase
{
  private CarabinerMessage carabinerMessage;

  protected void setUp() throws Exception
  {
    throw new IllegalArgumentException(
        "Use setUp( CarabinerMessage concreteImplementation ); instead!");
  }

  protected void setUp(CarabinerMessage concreteImplementation)
      throws Exception
  {
    super.setUp();
    carabinerMessage = concreteImplementation;
  }

  protected void tearDown() throws Exception
  {
    carabinerMessage = null;
    super.tearDown();
  }

  public void testGetComponent()
  {
    Component actualReturn = carabinerMessage.getComponent();
    assertEquals("return value", getExpectedComponent(), actualReturn);
  }

  public abstract Component getExpectedComponent();

  public void testGetHighlightColor()
  {
    Color actualReturn = carabinerMessage.getHighlightColor();
    assertEquals("return value", getExpectedHighlightColor(), actualReturn);
  }

  public abstract Color getExpectedHighlightColor();

  public void testGetIcon()
  {
    Icon actualReturn = carabinerMessage.getIcon();
    assertEquals("return value", getExpectedIcon(), actualReturn);
  }

  public abstract Icon getExpectedIcon();

  public void testGetName()
  {
    String actualReturn = carabinerMessage.getName();
    assertEquals("return value", getExpectedMessageName(), actualReturn);
  }

  public abstract String getExpectedMessageName();

  public void testToString()
  {
    String actualReturn = carabinerMessage.toString();
    assertTrue("return value",
        (getExpectedMessageName() + ": " + getExpectedMessage())
            .equals(actualReturn));
  }

  public abstract String getExpectedMessage();
}
